<?php
namespace app\admin\controller;

class Topictable extends Come{
    public function table(){
        $reslist=db('topic')->select();
        $this->assign('reslist',$reslist);
        return $this->fetch('topic-table');

        // $reslist	=	db('admin_user')->where('id',9)->paginate(10);
        // //	把分页数据赋值给模板变量list
        // $this->assign('reslist',$reslist);
        // //	渲染模板输出
        // return	$this->fetch('topic-table');

        // $reslist=db('topic')->alias('a')->join('user b','a.user_id=b.id')->join('topic c','a.topic_id = c.id')->
        // field('a.*,b.nickname,b.hend_img,c.*')->select();
        // dump($reslist);

        // $reslist=$reslist->all();
        // $data=array();
        // foreach($reslist as $val){
        //     $img_src=json_decode($val['img_src'],true);
        //     if($img_src !=NULL){
        //         $val['img_src']=$img_src[0];
        //     }
        // }
    }
    public function delete(){
        $delId=input('param.delId','','htmlspecialchars');
        $res=db('topic')->where('id',$delId)->delete();
        if($res>0){
            $this->success('删除成功!','admin/topictable/table');
        }else{
            $this->error('删除失败');
        }
    }
}